import { FGTeamInfo } from "./FGTeamInfo";
import { FootBallGameConst } from "./FootBallGameConst";
//class FGLineLink
    
    export  class FGLineLink /* flash.display.Sprite */
    {
        

        public get teamInfo(): FGTeamInfo
        {
            return this._teamInfo;
        }

        public set teamInfo(arg1: FGTeamInfo)
        {
            this._teamInfo = arg1;
            this.drawLine();
            return;
        }

        /* internal  */get lineColors(): Map<any, any> /* flash.utils.Dictionary */
        {
            var loc1=0;
            if (!this._lineColors) 
            {
                this._lineColors = new Map<any, any> /* flash.utils.Dictionary */();
                loc1 = 9211020;
                this._lineColors[FootBallGameConst.GROUP_TYPE_8] = loc1;
                this._lineColors[FootBallGameConst.GROUP_TYPE_4] = loc1;
                this._lineColors[FootBallGameConst.GROUP_TYPE_2] = loc1;
                this._lineColors[FootBallGameConst.GROUP_TYPE_1] = loc1;
            }
            return this._lineColors;
        }

        /* internal  */get lineLength(): Map<any, any> /* flash.utils.Dictionary */
        {
            if (!this._lineLength) 
            {
                this._lineLength = new Map<any, any> /* flash.utils.Dictionary */();
                this._lineLength[FootBallGameConst.GROUP_TYPE_8] = [8, 40, 13, 22];
                this._lineLength[FootBallGameConst.GROUP_TYPE_4] = [4, 80, 10, 40];
                this._lineLength[FootBallGameConst.GROUP_TYPE_2] = [6, 168, 7, 18];
                this._lineLength[FootBallGameConst.GROUP_TYPE_1] = [5, 43];
            }
            return this._lineLength;
        }

        /* internal  */drawLine(): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=0;
            if (this._teamInfo && this._teamInfo.gameInfo) 
            {
                loc1 = this.lineLength[this._teamInfo.gameInfo.type];
                this.graphics.clear();
                loc2 = this.lineColors[this._teamInfo.gameInfo.type];
                loc3 = 65280;
                if (this._teamInfo.isHasResult) 
                {
                    if (this._teamInfo.isWinerA) 
                    {
                        loc2 = loc3;
                        this.graphics.lineStyle(2, loc2);
                        this.graphics.moveTo(0, 0);
                        this.graphics.lineTo(loc1[0], 0);
                        if (this._teamInfo.gameInfo.type != FootBallGameConst.GROUP_TYPE_1) 
                        {
                            this.graphics.lineTo(loc1[0], loc1[3]);
                            this.graphics.lineTo(loc1[0] + loc1[2], loc1[3]);
                            loc2 = this.lineColors[this._teamInfo.gameInfo.type];
                            this.graphics.lineStyle(2, loc2);
                            this.graphics.moveTo(loc1[0], loc1[3]);
                            this.graphics.lineTo(loc1[0], loc1[1]);
                            this.graphics.lineTo(0, loc1[1]);
                        }
                        else 
                        {
                            this.graphics.lineTo(loc1[0], loc1[1] / 2);
                            loc2 = this.lineColors[this._teamInfo.gameInfo.type];
                            this.graphics.lineStyle(2, loc2);
                            this.graphics.moveTo(loc1[0], loc1[1] / 2);
                            this.graphics.lineTo(loc1[0], loc1[1]);
                            this.graphics.lineTo(0, loc1[1]);
                        }
                    }
                    else 
                    {
                        this.graphics.lineStyle(2, loc2);
                        this.graphics.moveTo(0, 0);
                        this.graphics.lineTo(loc1[0], 0);
                        if (this._teamInfo.gameInfo.type != FootBallGameConst.GROUP_TYPE_1) 
                        {
                            this.graphics.lineTo(loc1[0], loc1[3]);
                            loc2 = loc3;
                            this.graphics.lineStyle(2, loc2);
                            this.graphics.lineTo(loc1[0] + loc1[2], loc1[3]);
                            this.graphics.moveTo(loc1[0], loc1[3]);
                            this.graphics.lineTo(loc1[0], loc1[1]);
                            this.graphics.lineTo(0, loc1[1]);
                        }
                        else 
                        {
                            this.graphics.lineTo(loc1[0], loc1[1] / 2);
                            loc2 = loc3;
                            this.graphics.lineStyle(2, loc2);
                            this.graphics.moveTo(loc1[0], loc1[1] / 2);
                            this.graphics.lineTo(loc1[0], loc1[1]);
                            this.graphics.lineTo(0, loc1[1]);
                        }
                    }
                }
                else 
                {
                    this.graphics.lineStyle(2, loc2);
                    this.graphics.moveTo(0, 0);
                    this.graphics.lineTo(loc1[0], 0);
                    this.graphics.lineTo(loc1[0], loc1[1]);
                    this.graphics.lineTo(0, loc1[1]);
                    if (loc1.length >= 4) 
                    {
                        this.graphics.moveTo(loc1[0], loc1[3]);
                        this.graphics.lineTo(loc1[0] + loc1[2], loc1[3]);
                    }
                }
            }
            return;
        }

        /* internal */ /* var */_teamInfo: FGTeamInfo;

        /* internal */ /* var */_lineColors: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_lineLength: Map<any, any> /* flash.utils.Dictionary */;
    }
